home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / telecomm / 309 / dualterm / to_ascii.gfa (.txt) < prev    next >
GFA-BASIC Atari  |  1988-11-27  |  2KB  |  55 lines

  1. '
  2. ' TO_ASCII.BAS - converts atascii text files to ascii
  3. '
  4. CLS
  5. PRINT "Normal ATASCII text files cannot be viewed from the ST desktop or loaded"
  6. PRINT "into most ST text editors.  This program converts these files to standard"
  7. PRINT "ST format.  In the interest of speed, the program does not attemt to convert"
  8. PRINT "special ATASCII characters into their VT52 equivalents.  It only strips off"
  9. PRINT "the high bit on each character and converts the ATASCII CR to ASCII CR/LF."
  10. PRINT
  11. PRINT "Because of the buffers used to speed things up, the program must have free"
  12. PRINT "memory available of twice the file size being converted."
  13. PRINT
  14. PRINT "press any key..."
  15. '
  16. KEYGET dummy|
  17. CLS
  18. PRINT "Select ATASCII file to convert:"
  19. FILESELECT DIR$(0)+"\*.*","",filename$
  20. IF EXIST(filename$)
  21.   OPEN "I",#1,filename$
  22.   length%=LOF(#1)
  23.   DIM buffer|(length%)
  24.   buf1%=VARPTR(buffer|(0))
  25.   DIM buffer2|(length%*1.1)
  26.   buf2%=VARPTR(buffer2|(0))
  27.   BGET #1,buf1%,length%
  28.   CLOSE #1
  29.   CLS
  30.   PRINT "Select new ascii filename:"
  31.   FILESELECT DIR$(0)+"\*.*","",filename$
  32.   IF filename$<>""
  33.     OPEN "O",#2,filename$
  34.     CLS
  35.     DEFMOUSE 2
  36.     index%=0
  37.     FOR ctr%=0 TO length%-1
  38.       IF buffer|(ctr%)=155
  39.         buffer2|(index%)=13
  40.         INC index%
  41.         buffer2|(index%)=10
  42.       ELSE
  43.         buffer2|(index%)=buffer|(ctr%) AND 127
  44.       ENDIF
  45.       INC index%
  46.     NEXT ctr%
  47.     BPUT #2,buf2%,index%
  48.     CLOSE #2
  49.     DEFMOUSE 0
  50.   ENDIF
  51. ENDIF
  52. SYSTEM
  53. '
  54. ' end of listing
  55.